import { Navigate, Outlet, useAccess } from "@umijs/max"
import { message } from "antd"

/**
 * 权限校验拦截器
 */
export default () => {
  const { canUser } = useAccess()
  if (canUser) return <Outlet />
  else {
    message.warning('请先登录')
    return <Navigate to='/user/login' replace />
  }
}